const { app, BrowserWindow, Menu } = require("electron");
const isDev = require("electron-is-dev");
const Store = require("electron-store");
const menuTemplate = require('./src/temp/menuTemp') ;
Store.initRenderer();

let mainWindow;

app.whenReady().then(() => {
  mainWindow = new BrowserWindow({
    width: 1024,
    height: 600,
    show: false,
    minWidth: 600,
    webPreferences: {
      nodeIntegration: true,
      contextIsolation: false
    }
  });

  require("@electron/remote/main").initialize();
  require("@electron/remote/main").enable(mainWindow.webContents);

  // 添加自定义菜单

  const menu = Menu.buildFromTemplate(menuTemplate);
  Menu.setApplicationMenu(menu);

  mainWindow.on("ready-to-show", () => mainWindow.show());
  const urlLocation = isDev ? "http://localhost:3000" : "myUrl";
  mainWindow.loadURL(urlLocation);
});